//*********************************************************
// Subroutine for calculating vertex directional light
//   diffuse and specular component
//
// Output Registers used:
//   to r5 added diffuse color
//   to r6 added specular color
//
//*********************************************************

// Directional light
dp3 r4.x, inNormal, c[VL_MODEL_SPACE_LIGHT_DIR_SHADOWLENGTH]

//calculate half-vector(light vector + eye vector)
add r3, c[VL_MODEL_SPACE_LIGHT_DIR_SHADOWLENGTH], r7	//r3 = half vector
dp3 r3.w, r3, r3
rsq r3.w, r3.w
mul r3, r3, r3.w

dp3 r4.y, r3, inNormal		//r4.y = H * N
lit r3, r4

//calculating diffuse
mad r5.xyz, r3.y, c[VL_DLIGHT_DIFFUSE_1], r5

//calculating specular
mad r6, r3.z, c[VL_DLIGHT_SPECULAR_1], r6
